package cate.game.role.world.invite.comm;

import cate.common.game.invite.CateInviteEvent;
import cate.common.game.role.RoleAbstract;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.ToString;

@ToString
@NoteClass("受邀人")
public class Invitee {

    @NoteField("受邀人角色ID")
    public String id;

    @NoteField("受邀人所在区服ID")
    public int srvId;

    @NoteField("受邀人名称")
    public String name;

    @NoteField("受邀人等级")
    public int level;

    @NoteField("受邀人累计充值(分)")
    public long paySum;

    @NoteField(value = "受邀人其他补充信息", detail = "满足构成snapshot的简易数据")
    public RoleAbstract ext;

    public static Invitee fromEvent(CateInviteEvent event) {
        Invitee i = new Invitee();
        i.id = event.inviteeId;
        i.readEventBase(event);
        return i;
    }

    public Invitee readEventBase(CateInviteEvent event) {
        this.srvId = event.inviteeSrvId;
        this.name = event.inviteeName;
        this.level = event.inviteeLevel;
        this.paySum = event.inviteePaySum;
        this.ext = event.invitee;
        return this;
    }
}
